/*延迟数据请求接口线程
Created on 2020年05月10日
@author: zxyong 13738196011
 */

package com.zxy.tcp;

import java.io.IOException;
import java.util.ArrayList;

import com.zxy.business.Power_Control;
import com.zxy.business.Query_Data;
import com.zxy.common.Com_Para;

public class DelayDataThread extends Thread
{
	private Power_Control		pcl				= null;
	private String				sub_code		= "";
	private String				param_name		= "";
	private ArrayList<String>	aryParamValue	= null;
	private String				delay_code		= "";
	private String				strIP			= "0.0.0.0";

	public DelayDataThread(Power_Control spcl,String ssub_code,String sparam_name,ArrayList<String> saryParamValue,String sdelay_code,String strtIP)
	{
		this.setAryParamValue(saryParamValue);
		this.setParam_name(sparam_name);
		this.setPcl(spcl);
		this.setSub_code(ssub_code);
		this.setDelay_code(sdelay_code);
		this.setStrIP(strtIP);
	}

	// 把数据写入文件中
	public void run()
	{
		// 获取数据
		Query_Data qd = new Query_Data();
		StringBuilder sbd = qd.Cal_Data(pcl,sub_code,param_name,aryParamValue,strIP);
		com.zxy.adminlog.UsAdmin_Log uL = new com.zxy.adminlog.UsAdmin_Log(Com_Para.ApplicationPath,sbd,0);
		try
		{
			uL.InitWriteData(delay_code);
		}
		catch(IOException e)
		{
			System.out.println("把数据写入文件中错误:" + e.getMessage());
		}
	}

	public Power_Control getPcl()
	{
		return pcl;
	}

	public void setPcl(Power_Control pcl)
	{
		this.pcl = pcl;
	}

	public String getSub_code()
	{
		return sub_code;
	}

	public void setSub_code(String sub_code)
	{
		this.sub_code = sub_code;
	}

	public String getParam_name()
	{
		return param_name;
	}

	public void setParam_name(String param_name)
	{
		this.param_name = param_name;
	}

	public ArrayList<String> getAryParamValue()
	{
		return aryParamValue;
	}

	public void setAryParamValue(ArrayList<String> aryParamValue)
	{
		this.aryParamValue = aryParamValue;
	}

	public String getDelay_code()
	{
		return delay_code;
	}

	public void setDelay_code(String delay_code)
	{
		this.delay_code = delay_code;
	}

	public void setStrIP(String strtIP)
	{
		this.strIP = strtIP;
	}
}